<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Structures  Reference</title>
    <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="css/highlight.css" />
    <meta charset="utf-8">
    <script src="js/jquery.min.js" defer></script>
    <script src="js/jazzy.js" defer></script>
    
    <script src="js/lunr.min.js" defer></script>
    <script src="js/typeahead.jquery.js" defer></script>
    <script src="js/jazzy.search.js" defer></script>
  </head>
  <body>

    <a name="//apple_ref/swift/Section/Structures" class="dashAnchor"></a>

    <a title="Structures  Reference"></a>

    <header class="header">
      <p class="header-col header-col--primary">
        <a class="header-link" href="index.html">
          BigInt  Docs
        </a>
         (85% documented)
      </p>
    
      <p class="header-col--secondary">
        <form role="search" action="search.json">
          <input type="text" placeholder="Search documentation" data-typeahead>
        </form>
      </p>
    
        <p class="header-col header-col--secondary">
          <a class="header-link" href="https://github.com/attaswift/BigInt">
            <img class="header-icon" src="img/gh.png"/>
            View on GitHub
          </a>
        </p>
    
        <p class="header-col header-col--secondary">
          <a class="header-link" href="dash-feed://https%3A%2F%2Fattaswift.github.io%2FBigInt%2Freference%2Fdocsets%2FBigInt.xml">
            <img class="header-icon" src="img/dash.png"/>
            Install in Dash
          </a>
        </p>
    </header>

    <p class="breadcrumbs">
      <a class="breadcrumb" href="index.html">BigInt Reference</a>
      <img class="carat" src="img/carat.png" />
      Structures  Reference
    </p>

    <div class="content-wrapper">
      <nav class="navigation">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Extensions/BinaryFloatingPoint.html">BinaryFloatingPoint</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Extensions/String.html">String</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Structs.html">Structures</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/BigInt.html">BigInt</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/BigInt/Sign.html">– Sign</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/BigInt/Words.html">– Words</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/BigUInt.html">BigUInt</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/BigUInt/Words.html">– Words</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">

        <section class="section">
          <div class="section-content top-matter">
            <h1>Structures</h1>
            <p>The following structures are available globally.</p>

          </div>
        </section>

        <section class="section">
          <div class="section-content">
            <div class="task-group">
              <ul class="item-container">
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6BigInt0A4UIntV"></a>
                    <a name="//apple_ref/swift/Struct/BigUInt" class="dashAnchor"></a>
                    <a class="token" href="#/s:6BigInt0A4UIntV">BigUInt</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>An arbitary precision unsigned integer type, also known as a &ldquo;big integer&rdquo;.</p>

<p>Operations on big integers never overflow, but they may take a long time to execute.
The amount of memory (and address space) available is the only constraint to the magnitude of these numbers.</p>

<p>This particular big integer type uses base-2^64 digits to represent integers; you can think of it as a wrapper
around <code>Array&lt;UInt64&gt;</code>. (In fact, <code>BigUInt</code> only uses an array if there are more than two digits.)</p>

                        <a href="Structs/BigUInt.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">BigUInt</span> <span class="p">:</span> <span class="kt">UnsignedInteger</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigUInt</span><span class="p">:</span> <span class="kt">Codable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigUInt</span><span class="p">:</span> <span class="kt">Comparable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigUInt</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigUInt</span><span class="p">:</span> <span class="kt">ExpressibleByIntegerLiteral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigUInt</span><span class="p">:</span> <span class="kt">Strideable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigUInt</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigUInt</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigUInt</span><span class="p">:</span> <span class="kt">CustomPlaygroundDisplayConvertible</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/attaswift//tree/refs/tags/v5.3.0/Sources/BigUInt.swift#L16-L61">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <div class="task-name-container">
                <a name="/BigInt"></a>
                <a name="//apple_ref/swift/Section/BigInt" class="dashAnchor"></a>
                <div class="section-name-container">
                  <a class="section-name-link" href="#/BigInt"></a>
                  <h3 class="section-name"><p>BigInt</p>
</h3>
                </div>
              </div>
              <ul class="item-container">
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6BigIntAAV"></a>
                    <a name="//apple_ref/swift/Struct/BigInt" class="dashAnchor"></a>
                    <a class="token" href="#/s:6BigIntAAV">BigInt</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>An arbitary precision signed integer type, also known as a &ldquo;big integer&rdquo;.</p>

<p>Operations on big integers never overflow, but they might take a long time to execute.
The amount of memory (and address space) available is the only constraint to the magnitude of these numbers.</p>

<p>This particular big integer type uses base-2^64 digits to represent integers.</p>

<p><code>BigInt</code> is essentially a tiny wrapper that extends <code><a href="Structs/BigUInt.html">BigUInt</a></code> with a sign bit and provides signed integer
operations. Both the underlying absolute value and the negative/positive flag are available as read-write 
properties.</p>

<p>Not all algorithms of <code><a href="Structs/BigUInt.html">BigUInt</a></code> are available for <code>BigInt</code> values; for example, there is no square root or
primality test for signed integers. When you need to call one of these, just extract the absolute value:</p>
<pre class="highlight plaintext"><code>BigInt(255).magnitude.isPrime()   // Returns false
</code></pre>

                        <a href="Structs/BigInt.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">BigInt</span> <span class="p">:</span> <span class="kt">SignedInteger</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigInt</span><span class="p">:</span> <span class="kt">Codable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigInt</span><span class="p">:</span> <span class="kt">Comparable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigInt</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigInt</span><span class="p">:</span> <span class="kt">ExpressibleByIntegerLiteral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigInt</span><span class="p">:</span> <span class="kt">Strideable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigInt</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigInt</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">BigInt</span><span class="p">:</span> <span class="kt">CustomPlaygroundDisplayConvertible</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/attaswift//tree/refs/tags/v5.3.0/Sources/BigInt.swift#L29-L74">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </div>
        </section>

      </article>
    </div>
    <section class="footer">
      <p>© 2021 <a class="link" href="https://twitter.com/lorentey" target="_blank" rel="noopener" rel="external">Károly Lőrentey</a>. (Last updated: 2021-09-06)</p>
      <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="noopener" rel="external">jazzy ♪♫ v0.14.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="noopener" rel="external">Realm</a> project.</p>
    </section>
  </body>
</div>
</html>
